package org.dormi.learn.product.application.material;

import org.dormi.learn.product.domain.material.ModuleDependency;
import org.dormi.learn.product.domain.material.entity.Material;
import org.dormi.learn.product.domain.material.repo.MaterialRepository;

/**
 * add description here
 *
 * @author : dormi330
 * @version : 1.0
 */
public class MaterialQuery {

    private MaterialRepository repository = ModuleDependency.instance().getMaterialRepository();

    public MaterialQuery() {

    }

    public MaterialDTO findOne(Long id) {
        Material eo = repository.getById(id);
        if (eo == null) return null;

        return MaterialAssembler.MAPPER.toDTO(eo);
    }
}
